home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / EVLMEM.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-29  |  698b  |  27 lines

  1. FUNCTION evlmem(fdt: real; cof: glmarray; m: integer; pm: real): real;
  2. (* Programs using routine EVLMEM must define the types
  3. TYPE
  4.    glmarray = ARRAY [1..m] OF real;
  5. where m is the dimension of the array of coefficients. *)
  6. VAR
  7.    wr,wi,wpr,wpi,wtemp,theta: double;
  8.    sumi,sumr: real;
  9.    i: integer;
  10. BEGIN
  11.    theta := 6.28318530717959*fdt;
  12.    wpr := cos(theta);
  13.    wpi := sin(theta);
  14.    wr := 1.0;
  15.    wi := 0.0;
  16.    sumr := 1.0;
  17.    sumi := 0.0;
  18.    FOR i := 1 TO m DO BEGIN
  19.       wtemp := wr;
  20.       wr := wr*wpr-wi*wpi;
  21.       wi := wi*wpr+wtemp*wpi;
  22.       sumr := sumr-cof[i]*sngl(wr);
  23.       sumi := sumi-cof[i]*sngl(wi)
  24.    END;
  25.    evlmem := pm/(sqr(sumr)+sqr(sumi))
  26. END;
  27.